package com.example.app.data.enum

import com.example.app.R

enum class AccountRecordState(
    var label: String,
    var value: Any,
    var key: String
) {


    //获取账户记录
    ACCOUNT_RECORD_GET(
        "获取账户记录",
        "1",
        "ACCOUNT_RECORD_GET"
    ),
    //搜索账户记录
    ACCOUNT_RECORD_SEARCH(
        "搜索账户记录",
        "2",
        "ACCOUNT_RECORD_SEARCH"
    )
    ;

    companion object {
        fun getVarByLabel(label: String): AccountRecordState? {
            values().forEach {
                if (label == it.label) return it
            }
            return null
        }

        fun getVarByValue(value: Any): AccountRecordState? {
            values().forEach {
                if (value == it.value) return it
            }
            return null
        }

        fun getVarByKey(key: String): AccountRecordState? {
            values().forEach {
                if (it.key == key) return it
            }
            return null
        }
    }
}